package tasks.leetcode.爬楼梯;

/**
 * 爬楼梯问题.md
 * https://leetcode.cn/problems/climbing-stairs/description/
 */
public class Task70_2 {

    public static void main(String[] args) {
        int i = new Task70_2().climbStairs(10);
        System.out.println(i);
    }

    /**
     * 用重复赋值的方法
     * @param n
     * @return
     */
    public int climbStairs(int n) {
        if (n == 1) {
            return 1;
        }
        if (n == 2) {
            return 2;
        }
        return climbStairs(n - 1) + climbStairs(n - 2);
    }

}
